<template>
    <div class="view_con">
        <ul class="e_list" v-if="art.length>0">
            <li class="e_item" v-for="item in art" :key="item.id">
                <a :href="'#/userdetail?id='+item.id+'&name=榜样力量&url=#/work/example'">
                    <div class="e_img">
                        <img :src="item.image" alt="">
                    </div>
                    <div class="e_info">
                        <div class="e_title">{{item.title}}</div>
                        <div class="e_txt">
                            {{item.college}}
                        </div>
                        <div class="e_txt">
                            {{item.position}}
                        </div>
                    </div>
                </a>
            </li>
        </ul>
        <el-empty v-else></el-empty>
    </div>
</template>

<script>
export default {
    data() {
        return {
           art:[],
            total:0,
            type:1
        };
    },

    mounted() {
        this.getdata()
    },
    watch:{
        $route:{
            handler(newval,oldval){
                this.type = newval.query.type
                this.getdata()
            },
            deep:true,
            immediate:true
        }
    },
    methods: {
        getdata(){
            this.$api.post('getExampleList',{
                "sort":"sort",
                "limit":10 
            }).then(res=>{
                let arr = []
                res.data.list.forEach(item => {
                   if(item.belong == this.type){
                    arr.push(item)
                   } 
                });
                this.art = arr
                console.log(arr,this.art)
            })
        }
    },
};
</script>

<style lang="scss" scoped>
   @import  '@/assets/css/common.scss';
</style>